package com.ruihu.api.module.business.task.controller;

import com.ruihu.admin.common.anno.NoValidPrivilege;
import com.ruihu.admin.common.anno.OperateLog;
import com.ruihu.admin.common.domain.ResponseDTO;
import com.ruihu.admin.constant.SwaggerTagConst;
import com.ruihu.admin.module.business.node.config.domain.vo.TaskProcessConfigVO;
import com.ruihu.admin.module.business.node.config.service.TaskProcessConfigService;
import com.ruihu.admin.module.business.tasknode.service.NodeInstProcessRelationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = {SwaggerTagConst.Mobile.SUB_TASK_API})
@OperateLog
public class NodeInstFormElementController {

    @Autowired
    private TaskProcessConfigService taskProcessConfigService;

    @Autowired
    private NodeInstProcessRelationService nodeInstProcessRelationService;

    @ApiOperation(value = "查询动态节点配置",notes = "@author Tony")
    @PostMapping("/api/taskProcessConfig/dynamicElementList")
    @NoValidPrivilege
    public ResponseDTO<List<TaskProcessConfigVO>> queryDynamicConfigElementList() {
        return taskProcessConfigService.queryDynamicConfigElementList();
    }

    @ApiOperation(value="根据ID删除",notes = "@author Tony")
    @PostMapping("/api/nodeInstProcessRelation/delete/{id}")
    @NoValidPrivilege
    public ResponseDTO<String> deleteById(@PathVariable("id") Long id) {
        return nodeInstProcessRelationService.deleteById(id);
    }
}
